package com.cloudm.technician.ui.modules.common.guide

import android.os.Bundle
import android.support.v4.view.ViewPager
import com.cloudm.technician.R
import com.cloudm.technician.extensions.logger_e
import com.cloudm.technician.ui.base.BaseActivity
import kotlinx.android.synthetic.main.activity_guide.*

/**
 * 作者: wesley
 * 时间: 2017/12/13
 * 描述: 引导页
 */
class GuideActivity : BaseActivity(), ViewPager.OnPageChangeListener {

    override val layoutResID: Int
        get() = R.layout.activity_guide

    companion object {
        private const val TAG = "GuideActivity"
    }

    override fun handleBundle(bundle: Bundle) {

    }

    override fun initVariables() {

    }

    override fun initViews(savedInstanceState: Bundle?) {
        viewPager.adapter = GuidePagerAdapter(manager)
    }

    override fun initListener() {
        viewPager.addOnPageChangeListener(this)
    }

    override fun onPageScrollStateChanged(state: Int) {

    }

    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {

    }

    override fun onPageSelected(position: Int) {
        when (position) {
            0 -> rBtnOne.isChecked = true
            1 -> rBtnTwo.isChecked = true
            2 -> rBtnThree.isChecked = true
            else -> logger_e(TAG, " position = $position")
        }
    }
}